<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>系统设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" href="../../static/images/favicon.ico" th:href="@{/images/favicon.ico}"/>
    <link rel="stylesheet" href="../../static/lib/admin/lib/layui-v2.6.3/css/layui.css" th:href="@{/lib/admin/lib/layui-v2.6.3/css/layui.css}" media="all">
    <link rel="stylesheet" href="../../static/lib/admin/css/public.css" th:href="@{/lib/admin/css/public.css}" media="all">
    <style>
        .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <div class="layui-form layuimini-form">
            <div class="layui-form-item">
                <label class="layui-form-label required">网站名称</label>
                <div class="layui-input-block">
                    <input type="text" name="webname" th:value="${webname}" lay-verify="webname" lay-reqtext="网站域名不能为空" placeholder="请输入网站名称"  value="三岁" class="layui-input">
                    <tip>填写自己部署网站的名称。</tip>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label required">首页标题</label>
                <div class="layui-input-block">
                    <!--                    <textarea name="webTitle" th:text="${webTitle}" lay-verify="webTitle" class="layui-input">layuimini 简洁易用后台管理模板</textarea>-->
                    <input name="webTitle" th:value="${webTitle}" lay-verify="webTitle" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">网站域名</label>
                <div class="layui-input-block">
                    <input type="text" name="weburl" th:value="${weburl}" lay-verify="weburl" lay-reqtext="网站域名不能为空" placeholder="请输入网站域名"  value="#" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">缓存时间</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="cacheTime" th:value="${cacheTime}" lay-verify="number" value="0" class="layui-input">
                </div>
                <div class="layui-input-inline layui-input-company">分钟</div>
                <div class="layui-form-mid layui-word-aux">本地开发一般推荐设置为 0，线上环境建议设置为 10。</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">最大文件上传</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="maxFiles" th:value="${maxFiles}" lay-verify="number" value="2048" class="layui-input">
                </div>
                <div class="layui-input-inline layui-input-company">KB</div>
                <div class="layui-form-mid layui-word-aux">提示：1 M = 1024 KB</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上传文件类型</label>
                <div class="layui-input-block">
                    <input type="text" name="fileType" th:value="${fileType}" value="png" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META关键词</label>
                <div class="layui-input-block">
<!--                    <textarea name="metaTips" th:text="${metaTips}" class="layui-input" placeholder="多个关键词用英文状态 , 号分割"></textarea>-->
                    <input name="metaTips" th:value="${metaTips}" class="layui-input" placeholder="多个关键词用英文状态 , 号分割">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META描述</label>
                <div class="layui-input-block">
<!--                    <textarea name="metaNotes" th:text="${metaNotes}" class="layui-input">三岁博客-blog-sansui-sansuiblog</textarea>-->
                    <input name="metaNotes" th:value="${metaNotes}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
<!--                    <textarea name="copyRightInfo" th:text="${copyRightInfo}" class="layui-input">Copyright© 2022 三岁</textarea>-->
                    <input name="copyRightInfo" th:value="${copyRightInfo}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label required">版本号</label>
                <div class="layui-input-block">
<!--                    <textarea name="versionNumber" lay-verify="versionNumber" th:text="${versionNumber}" class="layui-input">1.0.1</textarea>-->
                    <input name="versionNumber" lay-verify="versionNumber" th:value="${versionNumber}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">统计代码</label>
                <div class="layui-input-block">
                    <textarea name="tongji" th:text="${tongji}" class="layui-textarea"></textarea>
                    <tip>支持 51.la \ 友盟等。</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script><!--引入jquery js-->
<script src="../../static/lib/admin/lib/layui-v2.6.3/layui.js" th:src="@{/lib/admin/lib/layui-v2.6.3/layui.js}" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form
            , layer = layui.layer;

        //监听提交
        form.on('submit(setting)', function (data) {

            $.ajax({
                url: '../page/saveSetting',
                type: 'post',
                dataType: 'json',
                contentType:'application/json;charset=utf-8',
                data: JSON.stringify(data.field),
                success: function (suc) {
                    // console.log(suc)
                    if (suc.code == 200) {
                        layer.msg(suc.msg, {icon: 1});
                    } else {
                        layer.msg(suc.msg, {icon: 5});
                    }
                },
                'error': function () {
                    layer.msg('系统错误');
                }
            });

            return false;
        });

        form.verify({
            webname: function (value) {
                if (value == null || value == '') {
                    return '我是谁呀';
                }
            },
            weburl: function (value) {
                if (value == null || value == '') {
                    return '填写一下地址呀，喂';
                }
            },
            webTitle: function (value) {
                if (value == null || value == '') {
                    return '确定不填写标题嘛';
                }
            },
            versionNumber: function (value) {
                if (value == null || value == '') {
                    return '呜呜呜,我是谁家的';
                }
            }
        });

    });
</script>
</body>
</html>